<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">基础信息</li>
                <li>简介内容</li>
            </ul>

            <div class="layui-tab-content">

                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label required">名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" class="layui-input" lay-verify="required" placeholder="请输入名称" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">分类</label>
                        <div class="layui-input-block">
                            {volist name="typeArr" id="vo"}
                            <input type="checkbox" class="layui-input" name="type[{$vo.id}]" title="{$vo.config_value}" value="{$vo.id}">
                            {/volist}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">营业开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="start_time" class="layui-input" lay-verify="required" placeholder="请输入开始时间" value="08:00">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">营业结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="end_time" class="layui-input" lay-verify="required" placeholder="请输入结束时间" value="18:00">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">联系电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="contact_phone" class="layui-input" lay-verify="required" placeholder="请输入联系电话" value="">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label required">位置名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="addr_name" class="layui-input" lay-verify="required" placeholder="请输入位置名称" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">详细地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="addr_text" class="layui-input" lay-verify="required" placeholder="请输入详细地址" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">经度</label>
                        <div class="layui-input-block">
                            <input type="text" name="longitude" min="0.000000" class="layui-input" lay-verify="required" placeholder="请输入经度" value="" onkeyup="limitInputNumSix(this)">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">纬度</label>
                        <div class="layui-input-block">
                            <input type="text" name="latitude" min="0.000000" class="layui-input" lay-verify="required" placeholder="请输入纬度" value="" onkeyup="limitInputNumSix(this)">
                            <tip>经纬度最多精确到小数点后六位。</tip>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">评分</label>
                        <div class="layui-input-block">
                            <input type="text" name="score" min="0.0" class="layui-input" lay-verify="required" placeholder="请输入评分" value="1.0" onkeyup="limitInputNum(this)">
                            <tip>满分5分，保留一位小数。</tip>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">本期推荐</label>
                        <div class="layui-input-block">
                            <input type="radio" class="layui-input" name="is_recommend" title="否" value="0" checked>
                            <input type="radio" class="layui-input" name="is_recommend" title="是" value="1">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">排序</label>
                        <div class="layui-input-block">
                            <input type="number" name="order" min="0" class="layui-input" lay-verify="required"  placeholder="请输入排序" value="">
                        </div>
                    </div>

                    <label class="layui-form-label required">顶部轮播图</label>
                    <div class="layui-input-block layuimini-upload">
                        <input name="files" class="layui-input layui-col-xs6" lay-verify="required" placeholder="请上传图片" value="" >
                        <div class="layuimini-upload-btn">
                            <span><a class="layui-btn" data-upload="files" data-upload-number="more" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
                            <span><a class="layui-btn layui-btn-normal" id="select_files" data-upload-select="files" data-upload-number="more" data-upload-mimetype="image/*"><i class="fa fa-list"></i> 选择</a></span>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label required">描述</label>
                        <div class="layui-input-block">
                            <input type="text" name="description" class="layui-input" lay-verify="required" placeholder="请输入描述" value="">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label required">简介</label>
                        <div class="layui-input-block">
                            <script type="text/plain" id="ueditor"></script>
                        </div>
                    </div>
                </div>
            </div>

            <div class="hr-line"></div>
            <div class="layui-form-item text-center">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            </div>
        </div>
    </form>
</div>
<style>
    tip{
        display: inline-block;
        margin-top: 10px;
        line-height: 15px;
        font-size: 10px;
        color: #a29c9c;
    }
</style>
<script type="text/javascript" src="/static/plugs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/static/plugs/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/plugs/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="/static/plugs/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
    var ueditor;
    $(function (){
        setTimeout(function (){
            initEditor(450)
        },1000)
    })
    function initEditor(height) {
        ueditor = UE.getEditor('ueditor', {
            initialFrameWidth: "100%", initialFrameHeight: height, zIndex: 9999
            , toolbars: [[
                'source','undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough'
                , 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote'
                , 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist'
                , 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|'
                , 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'directionalityltr'
                , 'directionalityrtl', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright'
                , 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink','anchor', '|', 'imagenone'
                , '|', 'simpleupload', 'insertimage', 'wordimage',
                , 'pagebreak', 'template', 'background', '|', 'horizontal', 'date', 'time', 'spechars'
                , '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable'
                , 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown'
                , 'splittocells', 'splittorows', 'splittocols', 'charts', '|', 'print', 'preview', 'searchreplace'
                , 'drafts'
            ]]
        });
    }
    function limitInputNum(obj){
        obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
        obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d).*$/,'$1$2.$3'); //只能输入一个小数
    }
    function limitInputNumSix(obj){
        obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
        obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d\d\d\d\d).*$/,'$1$2.$3'); //只能输入六个小数
    }
</script>